public class PostorderTree extends SortedTree {
	
	public PostorderTree(String node) {
		super(node);
	}
	
	public PostorderTree() {
		super();
	}
	
	@Override
	public String traverse() {
		return recTraverse(rootNode);
	}
	
	private String recTraverse(StringNode node) {
		
		String temp = node.getLabel();
		
		if (node.getRightChild() != null) {
			temp = recTraverse(node.getRightChild()) + " " + temp;
		} else {
			return temp;
		}
		
		if (node.getLeftChild() != null) {
			temp = recTraverse(node.getLeftChild()) + " " + temp;
		} else {
			return temp;
		}
		
		return temp;
	}
	
}